package com.bush.mall.coupon.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.coupon.entity.MemberPriceEntity;
import com.bush.mall.coupon.service.MemberPriceService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 商品会员价格
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("memberprice")
@Api(tags = "商品会员价格管理" )
public class MemberPriceController {

    @Resource(name= MemberPriceService.BEAN_ID)
    private MemberPriceService memberPriceService;

    /**
     * 分页查询商品会员价格列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询商品会员价格列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return memberPriceService.queryForPage(current,size);
    }

    /**
     * 保存商品会员价格表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存商品会员价格表单")
    @PostMapping
    public Result saveMemberPrice(@RequestBody MemberPriceEntity memberPrice){
        return memberPriceService.saveMemberPrice(memberPrice);
    }

    /**
     * 修改商品会员价格表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改商品会员价格表单")
    @PutMapping
    public Result updateMemberPrice(@RequestBody MemberPriceEntity memberPrice){
        return memberPriceService.updateMemberPrice(memberPrice);
    }

    /**
     * 通过指定id删除商品会员价格
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除商品会员价格")
    @DeleteMapping
    public Result deleteMemberPrice(Long id){
        return memberPriceService.deleteMemberPrice(id);
    }

}
